package crawler.client.sdk.task.java;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import crawler.client.sdk.task.BaseCrawlerTask;

public class CrawlerExtractInfo extends BaseCrawlerTask implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String data;
	private Integer statusCode;
	private String statusMsg;
	private List<CrawlerTaskInfo> crawlerTaskInfos;

	public CrawlerExtractInfo() {

	}

	/**
	 * 返回单个URL抓取结果
	 * 
	 * @param crawlerTaskInfos
	 */
	public CrawlerExtractInfo(CrawlerTaskInfo crawlerTaskInfo) {
		this.crawlerTaskInfos = new ArrayList<CrawlerTaskInfo>();
		this.crawlerTaskInfos.add(crawlerTaskInfo);
	}

	/**
	 * 返回多个URL抓取结果
	 * 
	 * @param crawlerTaskInfos
	 */
	public CrawlerExtractInfo(List<CrawlerTaskInfo> crawlerTaskInfos) {
		this.crawlerTaskInfos = crawlerTaskInfos;
	}
	
	/**
	 * 返回抓取数据
	 * 
	 * @param data
	 */
	public CrawlerExtractInfo(String data) {
		this.data = data;
	}
	
	/**
	 * 返回单个URL抓取结果和抓取数据
	 * 
	 * @param crawlerTaskInfos
	 * @param data
	 */
	public CrawlerExtractInfo(CrawlerTaskInfo crawlerTaskInfo,String data) {
		this.crawlerTaskInfos = new ArrayList<CrawlerTaskInfo>();
		this.crawlerTaskInfos.add(crawlerTaskInfo);
		this.data = data;
	}

	/**
	 * 返回多个URL抓取结果和抓取数据
	 * 
	 * @param crawlerTaskInfos
	 * @param data
	 */
	public CrawlerExtractInfo(List<CrawlerTaskInfo> crawlerTaskInfos,String data) {
		this.crawlerTaskInfos = crawlerTaskInfos;
		this.data = data;
	}

	
	/**
	 * 特殊情况控制抓取返回状态
	 * 
	 * 
	 * @param statusCode
	 * @param statusMsg
	 */
	public CrawlerExtractInfo(Integer statusCode, String statusMsg) {
		this.statusCode = statusCode;
		this.statusMsg = statusMsg;
	}

	
	
	public List<CrawlerTaskInfo> getCrawlerTaskInfos() {
		return crawlerTaskInfos;
	}

	public void setCrawlerTaskInfos(List<CrawlerTaskInfo> crawlerTaskInfos) {
		this.crawlerTaskInfos = crawlerTaskInfos;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public Integer getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(Integer statusCode) {
		this.statusCode = statusCode;
	}

	public String getStatusMsg() {
		return statusMsg;
	}

	public void setStatusMsg(String statusMsg) {
		this.statusMsg = statusMsg;
	}

	@Override
	public String toString() {
		return "CrawlerExtractInfo [data=" + data + ", statusCode=" + statusCode + ", statusMsg=" + statusMsg
				+ ", crawlerTaskInfos=" + crawlerTaskInfos + "]";
	}

}
